Add API methods and support for styling of icons (Tray, MenuItem) under Mac OS X (Yosemite) Dark Mode #2775
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
true
)iconsAreTemplates
toTray
objects to allow for proper display of icons in Mac OS X (Yosemite) Dark Menus.true
)iconsIsTemplate
toMenuItem
objects to allow for proper display of icons in Mac OS X (Yosemite) Dark Menus.FIX #2476
FIX #2773
FIX #2604
Mac OS X uses the
isTemplate()
property ofNSImage
objects to ensure proper styling of icons in bothNSMenuItem
s andNSStatusItem
s. When the property is set to true the images are treated as "templates" and the system automatically ensures proper styling according to the various states of the status item (e.g. dark menu, light menu, etc.).Template images should consist only of black and clear colours and can use the
alpha channel in the image to adjust the opacity of black content.
See Dark Menus in AppKit Release Notes for OS X v10.10
and
NSImage setTemplate:
.Further Notes:
Tray.iconsAreTemplates
) a little verbosity has been traded over making the intent more clear.icon
andalticon
(it's unlikely that an app uses two different strategies, either both the images are templates or either are not).icon
property of aTray
item which hasiconsAreTemplates
set totrue
the newicon
will be treated as a template image (without the need to setting againTray.iconsAreTemplates = true
).Example usage: